package cn.lbd.kill.server.service.impl;

import cn.lbd.kill.model.entity.ItemKill;
import cn.lbd.kill.model.mapper.ItemKillMapper;
import cn.lbd.kill.server.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class ItemServiceImpl implements ItemService {

    @Autowired(required = false)
    private ItemKillMapper itemKillMapper;


    /**
     * 列出“剩余数量 > 0”而且处于“秒杀时间段内”的待秒杀商品列表
     * 为了前端处理方便以及安全性，采用一字段canKill来决定商品在前端显示时是否可以秒杀！
     * @return
     */
    @Override
    public List<ItemKill> getKillItems() {
        return itemKillMapper.getKillItems();
    }

    @Override
    public ItemKill getKillItemsInfo(Integer id) {
        return itemKillMapper.getKillItemsInfo(id);
    }
}
